package org.example.myerp.service.serviceimpl;

import org.example.myerp.mapper.productDesign.customSetup.ProclassOneMapper;
import org.example.myerp.pojo.*;
import org.example.myerp.service.ProclassOneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * һ������˵�ҵ���ʵ����
 */
@Service
public class ProclassOneServiceImpl implements ProclassOneService {
	@Autowired
    ProclassOneMapper proclassOneMapper;
	@Autowired


	/**
	 * ��ѯȫ��һ��������Ϣ
	 */
	@Override
	public List<ProclassOne> getFindOneCslassifyAll() {
		List<ProclassOne> list = proclassOneMapper.findOneCslassifyAll();
		return list;
	}

	/**
	 * �����������в�ѯȫ��һ��������Ϣ����ҳ��ѯ��
	 */
	@Override
	public PageMyself<ProclassOne> findOneCslassifyByPagerMessage(Integer pageNum, Integer pageSize, String proName) {
		//�洢�������в�������
		Map params = new HashMap<String, Object>();
		params.put("pageNum", pageNum);
		params.put("pageSize", pageSize);
		params.put("proName","%" + proName + "%");
		//������ҳ�����࣬��Ϊ����ֵ
		PageMyself<ProclassOne> page = new PageMyself<ProclassOne>();
		if(pageNum != null && pageSize != null) {
			//���õ�ǰҳ���ҳ��С
			page.setPageNum(pageNum);
			page.setPageSize(pageSize);
		}
		//��ȡ��ǰҳ����
		List<ProclassOne> list = proclassOneMapper.findOneCslassifyByPagerMessage(params);
		//���÷�ҳ���������ʾ����
		page.setRows(list);
		//����������
		page.setTotal(proclassOneMapper.findOneCslassifyTotalNumber("%" + proName + "%"));
		return page;
	}

	/**
	 * ����һ��������Ϣ
	 */
	@Override
	public Integer getInsertOneCslassifyByProName(ProclassOne proclassOne) {
		Integer row = proclassOneMapper.insertOneCslassifyByProName(proclassOne);

		return row;
	}

	/**
	 * ����ɾ��һ��������Ϣ
	 */
	@Override
	public Integer getdeleteInBatchesOneCslassifyByIIds(Integer[] iIds) {
		Integer row = proclassOneMapper.deleteInBatchesOneCslassifyByIIds(iIds);
		return row;
	}


}
